{% extends 'base.html' %}
{% block tips %}
    <h3>作者管理</h3>
{% endblock tips %}
{% block content %}
    <div class="col-md-offset-1 col-md-10">
        <a href="{% url 'book:author_add' %}">
            <button type="button" class="btn btn-primary">添加作者</button>
        </a>
        <p>
        <h3 class="text-center">作者列表</h3>
        </p>
        <table class="table table-bordered table-striped table-hover">
            <!-- On rows -->
            <thead>
            <tr>
                <td class="success">编号</td>
                <td class="info">姓名</td>
                <td class="success">年龄</td>
                <td class="info">出生日期</td>
                <td class="success">电话</td>
                <td class="info">地址</td>
                <td class="success">操作</td>
            </tr>
            </thead>
            <tbody>
            {% for author in authors %}
                <tr>
                    <td>{{ forloop.counter }}</td>
                    <td>{{ author.name }}</td>
                    <td>{{ author.age }}
                    </td>
                    <td>{{ author.author_detail.birthday|date:"Y-m-d" }}</td>
                    <td>{{ author.author_detail.telephone }}</td>
                    <td>{{ author.author_detail.addr }}</td>
                    <td>
                        <button type="button" class="btn btn-warning"><a
                                href="{% url 'book:author_edit' author.id %}">编辑</a>
                        </button>
                        <button type="button" class="btn btn-danger"><a
                                href="{% url 'book:author_del' author.id %}">删除</a>
                        </button>
                    </td>
                </tr>
            {% endfor %}
            </tbody>
        </table>
    </div>

{% endblock content %}